package UI;

import obj.All;
import obj.drops;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class Keylist extends KeyAdapter {
    private All all;
    public Keylist(All all){
        this.all=all;
    }
    public void keyPressed(KeyEvent e) {
        switch(e.getKeyCode()){
            case KeyEvent.VK_A:
                all.user.move(-1*all.user.getspeed(),0);
                break;
            case KeyEvent.VK_D:
                all.user.move(all.user.getspeed(),0);
                break;
            case KeyEvent.VK_W:
                all.user.move(0,-1*all.user.getspeed());
                break;
            case KeyEvent.VK_S:
                all.user.move(0, all.user.getspeed());
                break;
            case KeyEvent.VK_SPACE:
                if(System.currentTimeMillis()-all.user.Last_shoot>=500) {
                    all.drop_user.add(new drops(all.user.Getx(),all.user.Gety(),-10,1,"E:\\java\\month3-game\\resource\\fireup.png"));
                    all.user.Last_shoot=System.currentTimeMillis();
                }
        }
    }
}
